package com.iad.controller.manager {
  import com.adobe.cairngorm.control.CairngormEvent;
  import com.adobe.cairngorm.control.CairngormEventDispatcher;
  import com.iad.controller.event.*;
  import com.iad.model.*;
  import mx.managers.CursorManagerPriority;
  import mx.managers.CursorManager;
  
  import flash.events.EventDispatcher;
  
  public class IADCursorManager extends EventDispatcher
  {
    [Bindable] private var model:ModelLocatorImpl = ModelLocatorImpl.getInstance();
    
    [Embed("/assets/images/linkCursor.png")]
    private var linkCursor:Class;
    
    [Embed("/assets/images/move_cursor.png")]
    private var moveCursor:Class;
    
    [Embed("/assets/images/grab.png")]
    private var grabCursor:Class;
      
    [Embed("/assets/images/grabbing.png")]
    private var grabbingCursor:Class;
    
    private static var _instance:IADCursorManager;
    
  
    public function IADCursorManager()  {
      if (_instance != null) {
        trace("Only one instance of IADCursorManager can be instantiated");
      }
    }
    
    public function showLinkCursor():void {
      CursorManager.setCursor(linkCursor, CursorManagerPriority.HIGH, -12, -3);
    }
 
    public function removeLinkCursor():void {
      CursorManager.removeAllCursors();
    }
    
    public function showMainLinkCursor():void {
      if (model.app.currentState != model.MAIN_VIEW) {
        CursorManager.setCursor(linkCursor, CursorManagerPriority.HIGH, -12, -3);
      }
    }
 
    public function removeMainLinkCursor():void {
      CursorManager.removeAllCursors();
    }
    
    public function showMoveCursor():void {
      CursorManager.setCursor(moveCursor, CursorManagerPriority.HIGH, 3, 2);
    }
 
    public function removeMoveCursor():void {
      CursorManager.removeAllCursors();
    }
    
    
    public function showGrabCursor():void {
      CursorManager.setCursor(grabCursor, CursorManagerPriority.HIGH, -18, -15);
    }
    
    
    public function showGrabbingCursor():void {
      CursorManager.setCursor(grabbingCursor, CursorManagerPriority.HIGH, -18, -15);
    }
    
    
    public static function getInstance():IADCursorManager {
      if (_instance == null)  {
        _instance = new IADCursorManager();
      }
      return _instance;
    }
    
  }
}